package tech.xs.sys.init;

import org.springframework.core.annotation.Order;
import org.springframework.stereotype.Component;
import tech.xs.common.framework.init.InitExecute;
import tech.xs.sys.service.*;

import javax.annotation.Resource;

@Component
@Order(10000)
public class SysInitData implements InitExecute {

    @Resource
    private SysDictService sysDictService;
    @Resource
    private SysUserService sysUserService;
    @Resource
    private SysRoleService sysRoleService;
    @Resource
    private SysRolePermissionService sysRolePermissionService;
    @Resource
    private SysConfigService sysConfigService;

    @Override
    public void execute() throws Exception {
        sysDictService.reloadAllDictCache();
        sysConfigService.deleteConfigCache();
        sysUserService.deleteUserDetailsCache();
        sysRoleService.deleteEnableRoleCache();
        sysRolePermissionService.deleteEnableRolePermissionCache();
    }

    @Override
    public boolean isErrorStop() {
        return true;
    }
}
